﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using fingerWinForm.Excel;

namespace fingerWinForm.UpdrsTests
{
    class TestsManager
    {
        private HandMovements handMovements;
        private FingerTaps fingerTaps;
        private UpdrsTests[] updrsTestsArray;
        private String side;


        struct UpdrsTests
        {
            public int testNumber;
            public string testName;
        }

        public TestsManager()
        {
            handMovements = new HandMovements();
            fingerTaps = new FingerTaps();
            updrsTestsArray = new UpdrsTests[2];
            side = "";
            initUpdrsTestsArray();
        }

        private void initUpdrsTestsArray()
        {
            updrsTestsArray[0].testNumber = 23;
            updrsTestsArray[0].testName = "Finger Taps";
            updrsTestsArray[1].testNumber = 24;
            updrsTestsArray[1].testName = "Hand Movements";

        }

        public void startTests(KinectTracker kinectController, MainWindow mainWindow, int testsListIndex ,string fileName)
        {
            switch (testsListIndex)
            {
                case 23:
                    mainWindow.upperTestNameLabel.Text = updrsTestsArray[0].testNumber + " - " + updrsTestsArray[0].testName + " - "+ side;
                    break;
                case 24:
                    mainWindow.upperTestNameLabel.Text = updrsTestsArray[1].testNumber + " - " + updrsTestsArray[1].testName + " - "+ side;
                    break;

            }
            kinectController.startRecordingRawData(mainWindow.stopWatchLabel, fileName);
        }

        public void showNextTestOnLabel(MainWindow mainWindow, int testsListIndex, KinectTracker kinectController, HandSide handSide)
        {
            side = (handSide == HandSide.LEFT ? "Left Hand" : "Right Hand");
            switch (testsListIndex)
            {
                case 23:
                    mainWindow.instructionLabel2.Text = updrsTestsArray[0].testNumber + " - " + updrsTestsArray[0].testName + " - " + side;
                    kinectController.setTestName(updrsTestsArray[0].testName); //used for saving under correct test name in the correct directory
                    break;
                case 24:
                    mainWindow.instructionLabel2.Text = updrsTestsArray[1].testNumber + " - " + updrsTestsArray[1].testName + " - " + side;
                    kinectController.setTestName(updrsTestsArray[1].testName); //used for saving under correct test name in the correct directory
                    break;

            } 
        }
    }
}
